<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				reviewRiskUserCache:"mkt-dd-salesOrderReview-reviewRiskUser-cache"
			})
		},
		methods:{
			initload(){
				let _that = this
				let pro1 = _that.om.request("tsysdict/getCombobox",{code:'38759'})
				Promise.all([pro1]).then(res=>{
					_that.$refs.autoform.changeEditor("title9_1","reviewRiskId",'data',configSelectData(res[0],'id','dicname'))
					_that.$refs.autoform.initSelectIndex("title9_1","reviewRiskId")
					_that.$refs.autoform.changeEditor("title9_1","reviewRiskUserId",{
						link:"../../public/pageSearch/pageSearch",
						"linkParam":{
							other:JSON.stringify({
								id:_that.$refs.autoform.formdata.reviewRiskUserId?_that.$refs.autoform.formdata.reviewRiskUserId:'',
								isContainLegal: false,
								isContainLeave: false,
								salaryPosCanBeNull: true
							}),
							url:"temployee/getAutoCombobox1",
							namefield:"username",
							searchfield:"q",
							placeholder:"请输入姓名",
							cachename:_that.reviewRiskUserCache
						}
					})
				})
			}
		},
		onShow() {
			let _that = this
			if(_that.$refs.autoform){
				uni.getStorage({
					key:_that.reviewRiskUserCache,
					success:(res)=>{
						if(res.data){
							let d = res.data
							let formdata = _that.$refs.autoform.formdata
							formdata.reviewRiskUserId = d.id
							formdata.reviewRiskUserName = d.username
							uni.removeStorage({
								key:_that.reviewRiskUserCache
							})
						}
					}
				})
			}
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
			if(e.configDataCacheKey){
				uni.getStorage({
					key: e.configDataCacheKey,
					success: function(res) {
						if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
							_that.autoformdata = res.data
							Object.assign(_that.initValue, _that.formdata)
							_that.autoformdata[0].order = _that.order
								_that.initload()
							}
						}
					})
				}
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
